package com.ruoyi.factorydata.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.factorydata.domain.MaterialRequisitionCodeDetial;
import com.ruoyi.factorydata.mapper.MaterialRequisitionCodeDetialMapper;
import com.ruoyi.factorydata.service.IMaterialRequisitionCodeDetialService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 领料单物料码详情Service业务层处理
 *
 * @author ruoyi
 * @date 2025-08-12
 */
@Service
public class MaterialRequisitionCodeDetialServiceImpl extends ServiceImpl<MaterialRequisitionCodeDetialMapper, MaterialRequisitionCodeDetial> implements IMaterialRequisitionCodeDetialService {
    @Autowired
    private MaterialRequisitionCodeDetialMapper materialRequisitionCodeDetialMapper;

    /**
     * 查询领料单物料码详情
     *
     * @param id 领料单物料码详情主键
     * @return 领料单物料码详情
     */
    @Override
    public MaterialRequisitionCodeDetial selectMaterialRequisitionCodeDetialById(Long id) {
        return materialRequisitionCodeDetialMapper.selectMaterialRequisitionCodeDetialById(id);
    }

    /**
     * 查询领料单物料码详情列表
     *
     * @param materialRequisitionCodeDetial 领料单物料码详情
     * @return 领料单物料码详情
     */
    @Override
    public List<MaterialRequisitionCodeDetial> selectMaterialRequisitionCodeDetialList(MaterialRequisitionCodeDetial materialRequisitionCodeDetial) {
        return materialRequisitionCodeDetialMapper.selectMaterialRequisitionCodeDetialList(materialRequisitionCodeDetial);
    }

    /**
     * 新增领料单物料码详情
     *
     * @param materialRequisitionCodeDetial 领料单物料码详情
     * @return 结果
     */
    @Override
    public int insertMaterialRequisitionCodeDetial(MaterialRequisitionCodeDetial materialRequisitionCodeDetial) {
        materialRequisitionCodeDetial.setCreateTime(DateUtils.getNowDate());
        return materialRequisitionCodeDetialMapper.insertMaterialRequisitionCodeDetial(materialRequisitionCodeDetial);
    }

    /**
     * 修改领料单物料码详情
     *
     * @param materialRequisitionCodeDetial 领料单物料码详情
     * @return 结果
     */
    @Override
    public int updateMaterialRequisitionCodeDetial(MaterialRequisitionCodeDetial materialRequisitionCodeDetial) {
        materialRequisitionCodeDetial.setUpdateTime(DateUtils.getNowDate());
        return materialRequisitionCodeDetialMapper.updateMaterialRequisitionCodeDetial(materialRequisitionCodeDetial);
    }

    /**
     * 批量删除领料单物料码详情
     *
     * @param ids 需要删除的领料单物料码详情主键
     * @return 结果
     */
    @Override
    public int deleteMaterialRequisitionCodeDetialByIds(Long[] ids) {
        return materialRequisitionCodeDetialMapper.deleteMaterialRequisitionCodeDetialByIds(ids);
    }

    /**
     * 删除领料单物料码详情信息
     *
     * @param id 领料单物料码详情主键
     * @return 结果
     */
    @Override
    public int deleteMaterialRequisitionCodeDetialById(Long id) {
        return materialRequisitionCodeDetialMapper.deleteMaterialRequisitionCodeDetialById(id);
    }
}